package com.yoomiito.app.adapter.my


import android.graphics.Color
import android.text.TextUtils
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.yoomiito.app.R
import com.yoomiito.app.model.my.ApplyInfo
import com.yoomiito.app.model.my.IncomeInfo
import com.yoomiito.app.utils.ImageLoader

class MyIncomeDetail2Adapter :
    BaseQuickAdapter<IncomeInfo, BaseViewHolder>(R.layout.item_income_detail) {

    override fun convert(helper: BaseViewHolder, item: IncomeInfo) {
        helper.setText(R.id.item_goods_order_id, "订单：" + item.orderId)
        val goodsPicIv = helper.getView<ImageView>(R.id.item_goods_order_pic)
        goodsPicIv.visibility = View.VISIBLE
        ImageLoader.getInstance()
            .into(goodsPicIv.context, item.image, goodsPicIv, R.drawable.goods_default)
        val goodsTitleTv = helper.getView<TextView>(R.id.item_goods_order_title)
        goodsTitleTv.text = item.nickname + "(" + item.mobile + ")"
        val mobile = helper.getView<TextView>(R.id.item_mobile)
        mobile.text = item.ctime
        val pay = helper.getView<TextView>(R.id.item_pay)
        pay.text = item.commissionTypeStr

        if (TextUtils.equals("余额", item.commissionTypeStr)) {
            pay.setBackgroundResource(R.drawable.bg_orange_15)
        } else if (TextUtils.equals("钱包", item.commissionTypeStr)) {
            pay.setBackgroundResource(R.drawable.bg_blue15)
        } else {
            pay.setBackgroundResource(R.color.color_tran)
        }

        helper.setText(R.id.item_goods_order_status, item.statusStr)
        helper.setText(R.id.item_goods_order_date, item.ctime)
        helper.setText(R.id.item_goods_order_price, "¥" + item.money);

        if (item.status == 1) {
            helper.setTextColor(R.id.item_goods_order_status, Color.parseColor("#333333"))
        } else {
            helper.setTextColor(R.id.item_goods_order_status, Color.parseColor("#FC873A"))
        }

    }


}
